<template>
  <div>
    <h2 align="center">云猛物流回执单</h2>
    <el-descriptions class="margin-top"
                     :column="2"
                     border>
      <template slot="extra">
        <download-excel class="export-excel-wrapper"
                        :data="json_data_log"
                        :fields="json_fields_log"
                        name="回执单.xls">
          <el-button type="primary"
                     icon="el-icon-download"
                     size="small">下载回执单</el-button>
        </download-excel>
      </template>
      <el-descriptions-item label="合同编号">{{receiptForm.contractId}}</el-descriptions-item>
      <el-descriptions-item label="回执描述">{{receiptForm.acceptanceRecords}}</el-descriptions-item>
      <el-descriptions-item label="回执时间">{{receiptForm.createTime}}</el-descriptions-item>
      <el-descriptions-item label="运单id">{{receiptForm.aWaybill.waybillId}}</el-descriptions-item>
      <el-descriptions-item label="运单编号">{{receiptForm.aWaybill.waybillNumber}}</el-descriptions-item>
      <el-descriptions-item label="发货人名字">{{receiptForm.aWaybill.senderName}}</el-descriptions-item>
      <el-descriptions-item label="发货人手机">{{receiptForm.aWaybill.senderMobile}}</el-descriptions-item>
      <el-descriptions-item label="发货人地址">{{receiptForm.aWaybill.senderAddr}}</el-descriptions-item>
      <el-descriptions-item label="收货人名字">{{receiptForm.aWaybill.receiverName}}</el-descriptions-item>
      <el-descriptions-item label="收货人手机">{{receiptForm.aWaybill.receiverMobile}}</el-descriptions-item>
      <el-descriptions-item label="收货人地址">{{receiptForm.aWaybill.receiverAddr}}</el-descriptions-item>
      <el-descriptions-item label="预计发货时间">{{receiptForm.aWaybill.deliveryTime}}</el-descriptions-item>
      <el-descriptions-item label="货物重量">{{receiptForm.aWaybill.goodsWeight}} kg</el-descriptions-item>
      <el-descriptions-item label="运费">￥{{receiptForm.aWaybill.freight}}</el-descriptions-item>
      <el-descriptions-item label="里程">{{receiptForm.aWaybill.distance}} km</el-descriptions-item>
      <el-descriptions-item label="预计到货时间">{{receiptForm.aWaybill.estimatedArriveTime}}</el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script>
import { listADriverReceipt } from '@/api/driveracc/drivercheck'
export default {
  name: 'Index',
  data() {
    return {
      form: {},
      receiptForm: {},
      json_fields_log: {
        "合同编号": 'contractId',
        "回执描述": 'acceptanceRecords',
        "回执时间": 'createTime',
        "运单id": 'aWaybill.waybillId',
        "运单编号": 'aWaybill.waybillNumber',
        "发货人名字": 'aWaybill.senderName',
        "发货人手机": 'aWaybill.senderMobile',
        "发货人地址": 'aWaybill.senderAddr',
        "收货人名字": 'aWaybill.receiverName',
        "收货人手机": 'aWaybill.receiverMobile',
        "收货人地址": 'aWaybill.receiverAddr',
        "预计发货时间": 'aWaybill.deliveryTime',
        "货物重量": 'aWaybill.goodsWeight',
        "运费": 'aWaybill.freight',
        "里程": 'aWaybill.distance',
        "预计到货时间": 'aWaybill.estimatedArriveTime',
      },
      json_data_log: [],
    }
  },
  created() {
    this.$bus.on('thebus', (val) => {
      this.form.contractId = val
      console.log(222)
      //请求回执单
      listADriverReceipt(this.form).then((response) => {
        this.receiptForm = response
        this.json_data_log.push(response)
      })
    })
  },
  beforeDestroy() {
    this.$bus.$off('thebus')
  },
  methods: {},
}
</script>

<style>
</style>

